﻿using System;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsListRelatedArticleControl_Settings : ControlSettingBase
    {
        #region get data settings
        public string SLTinHienThi
        {
            get { return GetControlSetting<string>(ModuleSettingNames.CmsListRelatedArticle.txtSLTienHienThi, PortalContext.LanguageAlias); }
        }
        public bool HienThiAnh
        {
            get
            {
                return GetControlSetting<bool>(ModuleSettingNames.CmsListRelatedArticle.ddlAnhMinhHoa, PortalContext.LanguageAlias);
            }

        }
        public bool HienTHiMota
        {
            get
            {
                return GetControlSetting<bool>(ModuleSettingNames.CmsListRelatedArticle.ddlMoTa, PortalContext.LanguageAlias);
            }

        }
        public bool HienTHiLinkCT
        {
            get
            {
                return GetControlSetting<bool>(ModuleSettingNames.CmsListRelatedArticle.ddlLinkCT, PortalContext.LanguageAlias);
            }

        }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            loadData();
        }
        private  void loadData()
        {
            if (SLTinHienThi != null) txtSLTienHienThi.Text = SLTinHienThi;
            ddlAnhMinhHoa.SelectedIndex = HienThiAnh ? 0 : 1;
            ddlMoTa.SelectedIndex = HienTHiMota ? 0 : 1;
            ddlLinkCT.SelectedIndex = HienTHiLinkCT ? 0 : 1;
        }
        public override void SaveSettings(System.Collections.Generic.Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(txtSLTienHienThi.ID, ModuleSettingNames.CmsListRelatedArticle.txtSLTienHienThi, settings);
            SetControlSettingForAllLanguages(ddlAnhMinhHoa.ID, ModuleSettingNames.CmsListRelatedArticle.ddlAnhMinhHoa, settings);
            SetControlSettingForAllLanguages(ddlMoTa.ID, ModuleSettingNames.CmsListRelatedArticle.ddlMoTa, settings);
            SetControlSettingForAllLanguages(ddlLinkCT.ID, ModuleSettingNames.CmsListRelatedArticle.ddlLinkCT, settings);
        }
    }
}